/*
 * @Author: mengxianwei mxw1@meitu.com
 * @Date: 2024-09-13 19:33:07
 * @LastEditors: mengxianwei mxw1@meitu.com
 * @LastEditTime: 2024-09-14 09:18:26
 * @FilePath: \qt-custom-control\MIconButton.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#ifndef MICONBUTTON_H
#define MICONBUTTON_H

#include <QObject>
#include <QPushButton>

#include "../Font/YunXiuIconFont.h"

class MIconButton : public QPushButton
{
    Q_OBJECT
  public:
    explicit MIconButton(QWidget *parent = nullptr);

    void setTextContent(const QString& text);
    void setIconIndex(YunXiuIconFont::IconIndex nIndex, int fontSize, int width);
    void setTextNormalStyle(QColor color);
    void setTextHoverStyle(QColor color);
    void setTextDisableStyle(QColor color);


  protected:
    void showEvent(QShowEvent *e) override;

    void paintEvent(QPaintEvent *evet) override;

  private:
    QString textContent_;
    YunXiuIconFont::IconIndex iconIndex_{YunXiuIconFont::kIconEmpty};
    int iconFontSize_;
    int iconWidth_;

    QColor normalColor_;
    QColor hoverColor_;
    QColor disableColor_;

};

#endif // MICONBUTTON_H
